package com.delivery.www.service.ServiceImpl;

import com.delivery.www.dao.SellerDao;
import com.delivery.www.dao.DaoImpl.SellerDaoImpl;
import com.delivery.www.po.Seller;
import com.delivery.www.service.SellerService;
import com.delivery.www.util.JdbcUtils;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

public class SellerServiceImpl implements SellerService {
    private final SellerDao sellerDao;

    public SellerServiceImpl() {
        sellerDao = new SellerDaoImpl();
    }

    @Override
    public boolean register(String name, String password, String email) {
        boolean flag = false;
        int i = sellerDao.register(name, password, 0, email);
        if (i > 0) {
            flag = true;
        }
        return flag;
    }

    @Override
    public Seller login(String name, String password) {
        Seller seller = null;
        seller = sellerDao.login(name, password);
        return seller;
    }

    @Override
    public List<Seller> getSeller() {
        List<Seller> sellers = null;
        sellers = sellerDao.getSeller();
        return sellers;
    }
}
